<?php

namespace app\model;

use think\Model;

class WebInfo extends Model
{
    public $webName;
    public $webKeywords;
    public $webDes;

    private $data;

    public function __construct(array $data = [])
    {
        parent::__construct($data);
        $this->data = array();
    }

    public function __destruct()
    {
        parent::__destruct();
        unset(
            $this->data
        );
    }

    public function updateWebInfo()
    {
        $this->data['web_name'] = $this->webName;
        $this->data['web_keywords'] = $this->webKeywords;
        $this->data['web_des'] = $this->webDes;
        return $this->save($this->data);
    }

    public function readFreshInfo()
    {
        $lastId = $this->getLastInsID();
        return $this->where('id', $lastId)
            ->field('web_name, web_keywords, web_des')
            ->find();
    }
}